﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage=""%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%@include file="page/common/jsloader.jsp"%>
<%@ page isELIgnored ="true" %>
<%
		String baseUrl = request.getContextPath();
%>
<%String ourpath = request.getContextPath();%>
<title>湖北移动自动语音通知管理平台</title>
</head>
<script type="text/javascript">

	   Ext.onReady(
	     function(){
	     Ext.QuickTips.init();
	   //  Ext.get('test').on('click',function(e){
	    
	  //  if(e.getKey() == Ext.EventObject.ENTER){
		//  Ext.getCmp("login-button").handler();
		// }
	 // })
	    })
	    
	    function keydown(e) {
			var currKey = 0,
			e = e || event;
			if (e.keyCode == 13) aoo();
		}
		document.onkeydown = keydown;
	    
	    function aoo(){
                   
                    // 	var form = document.frmindex;
						var userId = $("#userId").val();
						var password = $("#password").val();
						if(userId=="" || password == ""){
							Ext.Msg.alert('提示', '请输入用户名和密码.');
						}else{
							// 发送请求
							
							Anynote.ajaxRequest({
								baseUrl:  '<%=baseUrl %>' ,
							    baseParams: {userId:userId, password:password},						
						         action: '${pageContext.request.contextPath}/postLoginAction.action',
								 callback: function(jsonResult){
									// 设置Cookie
									//var rememberUserId = form.findField('rememberUserId').getValue();
									//var rememberPwd = form.findField('rememberPwd').getValue();
									//var autoLogin = form.findField('autoLogin').getValue();
									///if(rememberUserId){
									//	Ext.state.Manager.set('Anynote_userId', userId);
									//}else{
									//	Ext.state.Manager.set('Anynote_userId', '');
									//}
									//if(rememberPwd){
									//	Ext.state.Manager.set('Anynote_password', password);
									//}else{
									//	Ext.state.Manager.set('Anynote_password', '');
									//}
									//Ext.state.Manager.set('Anynote_autoLogin', autoLogin);
									//Ext.state.Manager.set('Anynote_hasLocked', false);
									Ext.Msg.wait("正在登录，请稍等...","","");
								 	location.href="<%=baseUrl %>/index.jsp";
								},
						     	showWaiting: true
							})
								}
								}
								
		function Register(){
		       var IsExsit = false;
		       // 注册前台新用户Form
				var addFrontUserFormPanel = new Ext.FormPanel({
					id: 'addFrontUserFormPanel',
			        labelWidth: 60,
			        buttonAlign: 'center',
			        border: false,
			        bodyStyle: 'padding:10px;text-align:left;background-color:transparent;',
		            items:[{// 账号
			                xtype:'textfield',
			                id:'login_acct',
			                name: 'login_acct',
			                fieldLabel: '用户名',
			                blankText:'用户名不能为空',
			                anchor:'98%',
			                allowBlank:false,
			                maxLength: 20,
			                listeners :{
			                blur:function(n){
                             var va = Ext.getCmp("login_acct").getValue();
			                 Ext.Ajax.request({
			                      url: 'proving_proving.action',
			                      params:{val:va,filed:'login_acct',table:'agent_t'},
			                         success: function(res) {            
			                         var data = Ext.util.JSON.decode(res.responseText);
			                         if(data.success == true){
			                           Ext.Msg.alert('错误', '该登录名已经存在,请重新输入!!!');
			                         }else{
			                         } 
			                      }  
			                  });
					        }
                       },
			           },{//真实姓名
			               xtype:'textfield',
			               id:'name',
			               name:'name',
			               fieldLabel:'真实姓名',
			               blankText:'真实姓名不能为空',   
			               anchor:'98%',
			               allowBlank:false,
			               maxLength: 20
			           },new Ext.form.TextField ({// 密码
			        	   inputType: 'password',
			               name:'login_pass',
			               fieldLabel:'密码',
			               blankText:'密码不能为空',
			               anchor:'98%',
			               allowBlank:false,
			               maxLength: 20
			           }),new Ext.form.TextField ({// 确认密码
		            	   inputType: 'password',
			               name:'repassword',
			               fieldLabel:'确认密码',
			               blankText:'密码不能为空',
			               anchor:'98%',
			               allowBlank:false,
			               maxLength: 20
		                }),{//手机号码
			               xtype:'numberfield',
			               name:'phone_num',
			               fieldLabel:'手机号码',
			               blankText:'手机号码不能为空',
			               anchor:'98%',
			               maxLength: 20
			           },{// 联系地址
			               xtype:'textfield',
			               id:'address',
			               name:'address',
			               fieldLabel:'联系地址',
			               blankText:'联系地址不能为空',
			               anchor:'98%',
			               allowBlank:false,
			               maxLength: 500
			           },{//店名
			               xtype:'textfield',
			               id:'store_name',
			               name:'store_name',
			               fieldLabel:'店名',
			               blankText:'店名不能为空',
			               anchor:'98%',
			               allowBlank:false,
			               maxLength: 100
			           },{//归属业务员
			               xtype:'textfield',
			               id:'vest_clerk_id',
			               name:'vest_clerk_id',
			               fieldLabel:'属业务员',
			               blankText:'属业务员不能为空',
			               anchor:'98%',
			               allowBlank:false,
			               maxLength: 20
			           },{// 所属区域
			               xtype:'textfield',
			               id:'area',
			               name:'area',
			               fieldLabel:'所属区域',
			               anchor:'98%',
			               allowBlank:false,
			               maxLength: 20
		                }],
			        buttons: [{
	                    text:'提交',
	                    handler: function(){
				        	var form = addFrontUserFormPanel.getForm();
						    if(form.isValid()){
						        //验证输入两次密码是否一致
						        if(form.findField('login_pass').getValue() == form.findField('repassword').getValue()){
							    	// 发送请求
									Anynote.ajaxRequest({
										baseUrl: '<%=baseUrl %>',
										baseParams: form.getValues(),
										action: '${pageContext.request.contextPath}/registerFrontUserInfor.action',
										callback: function(jsonResult){
											addFrontUserWindow.close();
										},
										showWaiting: true,
										failureMsg: '保存失败.'
									});
						        }else{
						            Ext.Msg.alert("提示", "两次输入的密码不一致!");
						        }
							}
	                	}
	                },{
	                    text: '重置',
	                    handler: function(){
	                		addFrontUserFormPanel.getForm().reset();
	                    }
	                }]
			    });
		
		       // 前台用户注册窗口
				var addFrontUserWindow = new Ext.Window({
					title: '注册用户',
					width: 320,
					height: 360,
					modal: true,
					maximizable: false,
					resizable: false,
					iconCls: 'user_add',
					layout:'fit',
					plain: true,
					items: [addFrontUserFormPanel]
				}).show();
		}
		
		function checkUserName() { 
                 
		}

function init(){
        window.document.frmindex.useraccount.focus();
}
</script>
<body style="margin:0; height:100%;">  
<form name="frmindex" method="post" action="Show_Longin.action" style="background:url(image/login_bg.png) #dfedfa no-repeat center; margin:0; padding:0;" >
    <input type="hidden" name="surl" value="<%=request.getAttribute("foreign")==null?"index.jsp":request.getAttribute("surl")%>"/>
<table cellspacing="0" cellpadding="0" align="center" style="width:704px; height:100%; border:0;">
  <tr>
    <td valign="middle">
		<!-- 账号错误提示信息 开始   报错时启用-->
		<!--<h1 style="float:left; color:#d00; font-size:22px; margin-top:255px; line-height:160%">账号或密码错误，请重新输入！</h1>-->
		<!-- 账号错误提示信息 结束 -->
	
		<table border="0" cellspacing="4" cellpadding="0" style="font-size:12px; color:#585858; margin-top:260px; float:right;">
          <tr>
			<td width="119" style="font-size:12px;letter-spacing:4px; text-align:right">帐号：</td>
			<td><input id="userId" name="useraccount" type="text" style="width:134px; height:20px; background:#fff; border:solid 1px #6b7984; margin-bottom:2px;" /></td>
		  </tr>
		  <tr>
			<td align="right" style="font-size:12px; letter-spacing:4px; text-align:right">密码：</td>
			<td><input name="password" id ="password"  type="password" style="width:134px; height:20px;; background:#fff; border:solid 1px #6b7984; margin-bottom:2px;" /></td>
		  </tr>
		  <tr>
			<td></td>
			<td valign="bottom" ><input id="test"  name="submit" type="button" style="font-size:12px; padding-top:2px; border:0; width:56px; height:22px;color:#003399; text-align:center; cursor:pointer; " value="登录" onClick="return aoo()" /> <input name="reset" type="reset" style="font-size:12px; padding-top:2px; border:0; width:56px; height:22px;color:#003399; text-align:center; cursor:pointer;" value="取消" /><input id="register"  name="register" type="button" style="font-size:12px; padding-top:2px; border:0; width:56px; height:22px;color:#003399; text-align:center; cursor:pointer; " value="注册" onClick="return Register()" /></td>
		  </tr>
		</table>
	</td>
  </tr>
</table>
</form>
</body>